
restore,'./irdc_dist_model/bgps_rb3.sav',/ver
n = string(n_elements(rb3),format="(I0)")

myps,'./irdc_dist_model/analysis_plots/contrast_plot.eps',xsize=11

multiplot,[2,1],xgap=0.04



plotsym,0,0.5,/fill

plot,rb3.c_meas,rb3.sig_c,psym=8,/xlog,/ylog,xtit='IRDC Contrast',$
     ytit=greek('sigma')+'!dC!n',ytickformat='exponent10',$
     color=cgColor('Black'),/nodata

polyfill,[1d-2,1d-2,1,1],[1d-3,1d-2,1,1d-3],color=cgColor('RYB5')
polyfill,[0.05,0.05,1],[0.05,1,1],color=cgColor('RED2')
axis,yaxis=1,/ylog,ytickformat='blank_axis'
axis,xaxis=0,/xlog,xtickformat='blank_axis'
axis,xaxis=1,/xlog,xtickformat='blank_axis'

oplot,rb3.c_meas,rb3.sig_c,psym=8,color=cgColor('Black')


vline,/log,0.01,thick=4,color=cgColor('Dodger Blue')

annot = cgColor('RYB1')
oplot,[1d-3,1.],[1d-3,1.],thick=4,color=annot,linestyle=3
cgtext,1d-4,0.5,'Consistent with C = 0',color=annot,$
       charsize=0.9
cgtext,0.06,0.7,'Examine',color=annot,$
       charsize=0.7

isig = WHERE(rb3.c_meas GT rb3.sig_c AND rb3.c_meas GE 0.01, nsig)
al_legend,/bottom,/right,textcolor=annot,box=0,['N!dsig!n = '+string(nsig,format="(I0)")]



al_legend,/bottom,/left,thick=4,linestyle=2,color=cgColor('Dodger Blue'),$
          ['C = 1%'],box=0,charsize=0.9


multiplot,/doyaxis



plothist,rb3.c_meas,bin=0.01,color='Black',/nodata,$
         xtit='IRDC Contrast',ytit='N per 0.01 bin',charsize=1.0,thick=4
ind5 = WHERE(rb3.c_meas GE 0.05, n5)
plothist,rb3[ind5].c_meas,bin=0.01,color='RED2',/fill,/overplot,$
         fcolor='RED2'
plothist,rb3.c_meas,bin=0.01,color='Black',thick=4,/overplot
plothist,rb3[isig].c_meas,bin=0.01,color=annot,/overplot,thick=4,/fill,$
         fcolor='White'
axis,xaxis=0,xtickformat='blank_axis'



vline,0.01,thick=4,color=cgColor('Dodger Blue')

annot = cgColor('RYB1')
al_legend,/top,/right,textcolor=cgColor('Black'),box=0,['N!dtotal!n = '+n]




multiplot,/reset
multiplot,/default
multiplot,/reset

myps,/done



END
